package com.smart.manage.service.impl;

import java.util.List;
import com.smart.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.smart.manage.mapper.HealthArticleMapper;
import com.smart.manage.domain.HealthArticle;
import com.smart.manage.service.IHealthArticleService;

/**
 * 健康百科文章Service业务层处理
 * 
 * @author lingyao
 * @date 2025-03-12
 */
@Service
public class HealthArticleServiceImpl implements IHealthArticleService 
{
    @Autowired
    private HealthArticleMapper healthArticleMapper;

    /**
     * 查询健康百科文章
     * 
     * @param articleId 健康百科文章主键
     * @return 健康百科文章
     */
    @Override
    public HealthArticle selectHealthArticleByArticleId(Long articleId)
    {
        return healthArticleMapper.selectHealthArticleByArticleId(articleId);
    }

    /**
     * 查询健康百科文章列表
     * 
     * @param healthArticle 健康百科文章
     * @return 健康百科文章
     */
    @Override
    public List<HealthArticle> selectHealthArticleList(HealthArticle healthArticle)
    {
        return healthArticleMapper.selectHealthArticleList(healthArticle);
    }

    /**
     * 新增健康百科文章
     * 
     * @param healthArticle 健康百科文章
     * @return 结果
     */
    @Override
    public int insertHealthArticle(HealthArticle healthArticle)
    {
        healthArticle.setCreateTime(DateUtils.getNowDate());
        return healthArticleMapper.insertHealthArticle(healthArticle);
    }

    /**
     * 修改健康百科文章
     * 
     * @param healthArticle 健康百科文章
     * @return 结果
     */
    @Override
    public int updateHealthArticle(HealthArticle healthArticle)
    {
        healthArticle.setUpdateTime(DateUtils.getNowDate());
        return healthArticleMapper.updateHealthArticle(healthArticle);
    }

    /**
     * 批量删除健康百科文章
     * 
     * @param articleIds 需要删除的健康百科文章主键
     * @return 结果
     */
    @Override
    public int deleteHealthArticleByArticleIds(Long[] articleIds)
    {
        return healthArticleMapper.deleteHealthArticleByArticleIds(articleIds);
    }

    /**
     * 删除健康百科文章信息
     * 
     * @param articleId 健康百科文章主键
     * @return 结果
     */
    @Override
    public int deleteHealthArticleByArticleId(Long articleId)
    {
        return healthArticleMapper.deleteHealthArticleByArticleId(articleId);
    }
}
